<template>
	<view class="page">
		<cu-custom bgColor="" :isBack="true">
		    <block slot="backText">返回</block>
		    <block slot="content"></block>
		</cu-custom>
		<view class="margin-top-xl padding">
			<view class="top-rule margin-top padding text-center">
				<text class="text-white text-xxl">应用设置</text>
			</view>
			<view class="bottom-rule">
				<view class="cu-list menu shadow-lg">
					<view class="cu-item arrow">
						<view class="content" @click="clearCache">
							<!-- <text class="cuIcon-friend"></text> -->
							<uni-icons custom-prefix="iconfont" type="icon-clear" :size="icoSize" :color="icoColor"></uni-icons>
							<text class="text-grey margin-left-sm">清理缓存</text>
						</view>
					</view>
					<view class="cu-item arrow">
						<navigator class="content" url="/pages/log/operationlog/operationlog">
							<!-- <text class="cuIcon-cascades text-blue"></text> -->
							<uni-icons custom-prefix="iconfont" type="icon-caidan" :size="icoSize" :color="icoColor"></uni-icons>
							<text class="text-grey margin-left-sm">操作日志</text>
						</navigator>
					</view>
				</view>
			</view>
		</view>
		<view class="padding">
			<button class="bg-red text-lg" @click="handleLogout">
				<text>退出登录</text>
			</button>
		</view>
	</view>
</template>

<script>
	import storage from '@/utils/storage'
	export default {
		data() {
			return {
				icoColor:"#0081ff",
				icoSize:20,
			}
		},
		methods: {
			//退出登录
			handleLogout() {
			  this.$modal.confirm('确定注销并退出系统吗？').then(() => {
			    this.$store.dispatch('LogOut').then(() => {
			      this.$tab.reLaunch('/pages/index/index')
			    })
			  })
			},
			//
			clearCache(){
				let storageInfo = uni.getStorageInfoSync();
				let size = storageInfo.currentSize;
				uni.showLoading({
					title:'正在清理缓存'
				})
				uni.clearStorageSync();
				uni.hideLoading();
				uni.showToast({
					title:'清理完成!',
					icon:'success'
				})
			}
		},
	}
</script>

<style lang="scss">
.page {
	height: 100vh;
	width: 100vw;
    background-color: #F5F6F7;
  }
.top-rule {
    height: 140rpx;
    line-height: 140rpx;
    padding: 0px 40rpx;
    background-color:#3C96F3;
    border-radius: 16px 16px 0 0;
    // box-shadow: 0px 16px 26px rgba(0, 0, 0, .8);
  }
  .bottom-rule {
      // height: 140rpx;
      // line-height: 140rpx;
      // padding: 0px 40rpx;
      // background-color:#F3F4F6;
      border-radius: 0 0 16px 16px;
      // box-shadow: 0px 16px 26px rgba(0, 0, 0, .8);
    }
</style>
